﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DentalSoftware
{
    public partial class MainForm : Form
    {  
        public MainForm()
        {
            InitializeComponent();
        }

        private void CloseAllForm()
        {  
            foreach (Form form in this.MdiChildren)
            {
                form.Close();
            }
        }

        private void tsbBenhNhan_Click(object sender, EventArgs e)
        {
            CloseAllForm();
            BenhNhanForm frm = new BenhNhanForm(this.Width, this.Height - 85 - 100);
            frm.MdiParent = this;           
            frm.Show();
            this.Text = "Phòng răng _ Bệnh nhân";
        }

        private void tsbDieuTri_Click(object sender, EventArgs e)
        {
            CloseAllForm();
            DieuTriForm frm = new DieuTriForm(this.Width, this.Height - 85 - 100);
            frm.MdiParent = this;
            frm.Show();
            this.Text = "Phòng răng _ Điều trị";
        }

        private void tsbThuChi_Click(object sender, EventArgs e)
        {
            CloseAllForm();
            ThuChiForm frm = new ThuChiForm(this.Width, this.Height - 85 - 100);
            frm.MdiParent = this;
            frm.Show();
            this.Text = "Phòng răng _ Thu chi";
        }

        private void tsbThongTin_Click(object sender, EventArgs e)
        {
            CloseAllForm();
            ThongTinForm frm = new ThongTinForm(this.Width, this.Height - 85 - 100);
            frm.MdiParent = this;
            frm.Show();
            this.Text = "Phòng răng _ Thông tin";
        }       

        private void MainForm_Load(object sender, EventArgs e)
        {
            CloseAllForm();
            BenhNhanForm frm = new BenhNhanForm(this.Width, this.Height - 85 - 100);
            frm.MdiParent = this;
            frm.Show();
            this.Text = "Phòng răng _ Bệnh nhân";
        }       
    }
}
